import pandas as pd
list = [[110,120,105],[95,110,108],[98,80,100],[112,106,97]]
index = ['王蒙','李珊','赵胜','刘文']
columns = ['语文','数学','英语']
df = pd.DataFrame(list,index,columns)
df.loc['王琳'] = [90,100,80]
print('增加王琳后:\n',df)
df.insert(2,'政治',[85,88,70,73,77])
print('再增加政治后数据:\n',df)
df.insert(4,'物理',[82,65,60,63,67])
print(df)
import pandas as pd
list = [[110,120,105],[95,110,108],[98,80,100],[112,106,97]]
index = ['王蒙','李珊','赵胜','刘文']
columns = ['语文','数学','英语']
df = pd.DataFrame(list,index,columns)
print('原始数据:\n',df)
print('王蒙所有成绩:\n',df.iloc[0])
print('王蒙和刘文所有成绩:\n',df.iloc[[0,3]])
print('王蒙和赵胜所有成绩:\n',df.iloc[0:3])
print('王蒙和赵胜的语文和数学成绩',df.iloc[[0,2],[0,1]])
print('王蒙到赵胜的语文和英语成绩',df.iloc[0:3,[0,2]])
df.index = ['a','b','c','d']
df.columns = ['a','b','c']
print(df)

df11 = df.rename({'张蒙':'张三'})
df11.loc['张三'] = [0,0,0]
print(df)
print(df11)

df1 = df.rename({'英语':'政治'},axis='columns')
df1 ['政治'] = [8,8,7,7]
print(df1)